package org.example.springboot.service;

import org.apache.ibatis.annotations.Param;
import org.example.springboot.dao.ItemsMapper;
import org.example.springboot.dao.SuppliersMapper;
import org.example.springboot.model.Items;
import org.example.springboot.model.Suppliers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ItemsService {
    @Autowired
    private ItemsMapper itemsMapper;

    public String insertItem(String projectName, String projectLeader, String contactPhone, String salesTeam, String salesContactPhone,String afterSalesTeam, String afterSalesContactPhone, String projectDescription,String costDescription){
        itemsMapper.insertItem(projectName,projectLeader,contactPhone,salesTeam,salesContactPhone,afterSalesTeam,afterSalesContactPhone,projectDescription,costDescription);
        return "succeed";
    }

    public List<Items> getAllItems(){
        return itemsMapper.getAllItems();
    }

    public Items findItemById(int id){
        return itemsMapper.findItemById(id);
    }

    public List<Items> findItemByKeyword(String keyword){
        return itemsMapper.findItemByKeyword(keyword);
    }

    public void deleteItemById(int id){
        itemsMapper.deleteItemById(id);
    }
}
